package com.example.demo.NiuKe.v02;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br =  new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String s1 = br.readLine();
        char c = s1.charAt(0);
        int count =0;
        for (int i =0;i<s.length();i++){
            char c1 = s.charAt(i);
            if(c-32==c1 || c+32 ==c1 || c==c1){
                count++;
            }
        }
        System.out.println(count);
    }
}
